using System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Linq;
using
System.Text;
using
System.Windows.Forms;
namespace Demo_1
{
public partial class Form1 : Form
{
const string myViewName = "my
dynamic section";
const string dataName_rowArray = "row
array";
const string dataName_selectedItem = "selected item";
public
Form1()
{
InitializeComponent();
textBox1.Text = "Apple;
//1. Expose all the variables --------------------
//exposed and update variable dataName_rowArray (corresponds to the table rows on iOS devices)
(1)
INFOMATO.WCF.DataExchangeService.(myViewName, dataName_rowArray, "");
//expose variable name selected_item (corresponds to what you tap on Apple's i-Devices)
INFOMATO.WCF.DataExchangeService.(myViewName, dataName_selectedItem, "");
//2. Subscribe to the event when an action takes place on Apple's i-Devices.
(2)
INFOMATO.WCF.DataExchangeService.clientSetData_ID_Event +=
new
INFOMATO.WCF.DataExchangeService.ClientSetData_ID_Delegate(DataExchangeService_clientSetData_ID_Event);
}
//event handler for the INFOMATO.WCF.DataExchangeService.clientSetData_ID_Event
void
DataExchangeService_clientSetData_ID_Event(string
clientIP, string viewName, string dataName, object
dataValue, long processID)
{
if
(viewName == myViewName && dataName == dataName_selectedItem)
UpdateTextGUIObject(textBox2, (string)dataValue);
}
//event handler for the textbox1 when its value changes
private
void textBox1_TextChanged(object sender, EventArgs
e)
{
(3a)
INFOMATO.WCF.DataExchangeService.servicePostData(myViewName, dataName_rowArray, textBox1.Text);
}
//UIThread safe procedure to update UI parameters
private
void UpdateTextGUIObject(object guiObject, string
stringValue)
{
//check it the
thread is a UI thread
if
(this.InvokeRequired) //not
UI thread
{
MethodInvoker
del = delegate
{
UpdateTextGUIObject(guiObject, stringValue);
};
this.Invoke(
}
else
//Yes, it is UI thread
{
if
(guiObject is TextBox)
{
((TextBox)guiObject).Text
= stringValue;
}
}
}
//event handler for the textbox2 when its value changes.
private
void textBox2_TextChanged(object sender, EventArgs e)
{
(3b)
INFOMATO.WCF.DataExchangeService.(myViewName, dataName_selectedItem, "");
}
}
}